<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Uplaod</title>
    <script src="/common/js/jquery-1.11.3.min.js"></script>
</head>
<body>
<!--<form action="http://localhost:8080/fileup" enctype="multipart/form-data" method="post">-->
<!--<input type="file" id="file" name="file">-->
<!--<input type="submit" id="butto" value="上传">-->
<!-- </form>-->
<p>JSON</p>
<form id="ccccc">
<input type="file" id="file" name="file"  multiple="multiple" accept="image/*">
</form>
<input type="button" id="button" value="上传" >
返回的url为：<p id="url"></p>
</body>
<script type="text/javascript">
    $(function () {
        $("#button").click(function () {
            var form = new FormData();
            for(var i=0;i<$("#ccccc #file")[0].files.length;i++){
                form.append("file", $("#ccccc #file")[0].files[i]);
            }
            $.ajax({
                url: "/retPersonage/informationadd",        //后台url
                data: form,
                cache: false,
                async: false,
                type: "POST",                   //类型，POST或者GET
                dataType: 'json',              //数据返回类型，可以是xml、json等
                processData: false,
                contentType: false,
                success: function (data) {      //成功，回调函数
                    if (data.result == 1) {
                        $("#url").html(data.url);
                        alert("成功！")

                    } else {
                        alert("失败");
                    }

                },
                error: function (er) {          //失败，回调函数
                    alert(er);
                }
            });

        })

    })

</script>
</html>